﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;

namespace SHMBOSNS.goods_trade
{
    public partial class good_info : System.Web.UI.Page
    {
        int count = 1;

        protected void Page_Load(object sender, EventArgs e)
        {
            
        }

        protected void Button2_Click(object sender, EventArgs e)
        {
            string f_name, f_size, f_type;
            //Request.Files：获取采用多部分MIME格式的由客户端上载的文件的集合 
            HttpFileCollection hfc = Request.Files;
            for (int i = 0; i < hfc.Count; i++)
            {
                //HttpPostedFile ：提供对客户端已上载的单独文件的访问 
                HttpPostedFile hpf = hfc[i];
                //返回指定路径字符串的文件名和扩展名 
                f_name = Path.GetFileName(hpf.FileName);
                //获取上载文件的大小 
                f_size = hpf.ContentLength.ToString();
                //获取客户端发送的文件的MIME内容类型 
                f_type = hpf.ContentType;
                //将上传文件保存到服务器上指定路径 
                hpf.SaveAs(Server.MapPath("~/upload/") + f_name);
                switch (count)
                {
                    case 1:
                        Image1.ImageUrl = @"http://imgsrc.baidu.com/baike/pic/item/38403f3f8ec148dc55e72324.jpg";
                        Image1.Visible = true;
                        break;
                    case 2:
                        Image2.ImageUrl = @"http://imgsrc.baidu.com/baike/pic/item/38403f3f8ec148dc55e72324.jpg";
                        Image2.Visible = true;
                        break;
                    case 3:
                        Image3.ImageUrl = @"http://imgsrc.baidu.com/baike/pic/item/38403f3f8ec148dc55e72324.jpg";
                        Image3.Visible = true;
                        break;
                    case 4:
                        Image4.ImageUrl = @"http://imgsrc.baidu.com/baike/pic/item/38403f3f8ec148dc55e72324.jpg";
                        Image4.Visible = true;
                        break;
                    case 5:
                        Image5.ImageUrl = @"http://imgsrc.baidu.com/baike/pic/item/38403f3f8ec148dc55e72324.jpg";
                        Image5.Visible = true;
                        break;
                    case 6:
                        Image6.ImageUrl = @"http://imgsrc.baidu.com/baike/pic/item/38403f3f8ec148dc55e72324.jpg";
                        Image6.Visible = true;
                        break;
                    case 7:
                        Image7.ImageUrl = @"http://imgsrc.baidu.com/baike/pic/item/38403f3f8ec148dc55e72324.jpg";
                        Image7.Visible = true;
                        break;
                    case 8:
                        Image8.ImageUrl = @"http://imgsrc.baidu.com/baike/pic/item/38403f3f8ec148dc55e72324.jpg";
                        Image8.Visible = true;
                        break;
                }
                ++count;
                Label8.Text = Server.MapPath("~/up/") + f_name;
                //Response.Write(f_name + "<br>" + f_size + "bytes" + "<br>" + f_type + "<br>");
            }
            UpdatePanel1.Update();
        }

        
    }


}